package com.wd.mylibrary_base.utils

import com.wd.mylibrary_base.bean.AttentionBean
import com.wd.mylibrary_base.bean.ChangeNameBean
import com.wd.mylibrary_base.bean.CheckBean
import com.wd.mylibrary_base.bean.CloseLiveBean
import com.wd.mylibrary_base.bean.ConstellationListBean
import com.wd.mylibrary_base.bean.FindLeaderBoardBean
import com.wd.mylibrary_base.bean.HeadPicBean
import com.wd.mylibrary_base.bean.LiveBean
import com.wd.mylibrary_base.bean.LoginBean
import com.wd.mylibrary_base.bean.MusicBean
import com.wd.mylibrary_base.bean.MyMessageBean
import com.wd.mylibrary_base.bean.NearBean
import com.wd.mylibrary_base.bean.OpenLiveBean
import com.wd.mylibrary_base.bean.PutBean
import com.wd.mylibrary_base.bean.SearchBean
import com.wd.mylibrary_base.bean.WatchBean
import io.reactivex.Observable
import okhttp3.MultipartBody
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Part
import retrofit2.http.Query

/**
 * 作者: 邢凌志
 * 时间: 2024/9/12
 * 描述:
 */
interface ApiService {

    //登录
    @POST("live-user/v1/login")
    fun  getlogin(@Body map: Map<String,String>): Observable<LoginBean>

    //直播 录播 列表
    @GET("live-platform/findLiveList")
    suspend fun getLive(
        @Header("userId")userid:Int,
        @Query("liveType")liveType:Int,
        @Query("page")page:Int,
        @Query("size")size:Int,
    ): LiveBean

    //根据名字搜索主播
    @GET("live-platform/findLiveByNickName")
    suspend fun getSearch(
        @Header("userId")userid: Int,
        @Query("nickName")nickName:String,
        @Query("page")page:Int,
        @Query("size")size:Int,
    ):SearchBean

    //看直播 看录播
    @GET("live-platform/watchLive")
    suspend fun getWatch(
        @Header("userId")userid: Int,
        @Header("sessionId")sessionId: String,
        @Query("liveId")liveId:Int
    ):WatchBean

//修改头像
    @Multipart
    @POST("live-user/verify/modifyHeadPic")
    suspend fun getHeadPic(
        @Header("userId")userid: Int,
        @Header("sessionId")sessionId: String,
        @Part image: MultipartBody.Part,
    ):HeadPicBean

    //检查是否 实名认证
    @GET("live-user/verify/checkVerified")
    suspend fun getCheck(
        @Header("userId")userid: Int,
        @Header("sessionId")sessionId: String,
    ): CheckBean


    @GET("live-platform/findLiveList")
    suspend fun getNearby(
        @Header("userId")userid: Int,
        @Query("liveType")liveType:Int,
        @Query("page")page:Int,
        @Query("size")size:Int,
    ): NearBean

    //星座匹配列表
    @GET("live-user/verify/findRecommendConstellation")
    suspend fun getConstellation(
        @Header("userId")userid: Int,
        @Header("sessionId")sessionId:String,
        @Query("count")count:Int,
        @Query("maxFriendId")maxFriendId:Int,
    ):ConstellationListBean

    //关注
    @POST("live-user/verify/attention")
    suspend fun getAttention(
        @Header("userId")userid: Int,
        @Header("sessionId")sessionId:String,
        @Query("friend")friend:String,
    ):AttentionBean

    //取消关注
    @DELETE("live-user/verify/cancelFollow")
    suspend fun getCancelAttention(
        @Header("userId")userid: Int,
        @Header("sessionId")sessionId:String,
        @Query("friend")friend:Int,
    ): AttentionBean


    //查询榜单
    @GET("live-platform/findLeaderBoard")
    fun getFindLeaderBoardData():Observable<FindLeaderBoardBean>
    //开播
    @Multipart
    @POST("live-platform/verify/openLive")
    fun postOpenLive(
        @Header("userId")userId:Int,
        @Header("sessionId")sessionId:String,
        @Query("liveType") liveType:Int,
        @Query("liveTitle") liveTitle:String,
        @Query("longitude") longitude:String,
        @Query("latitude") latitude:String,
        @Part part: MultipartBody.Part
    ): Observable<OpenLiveBean>

    //开始推流
    @PUT("live-platform/verify/startPushStream")
    fun startPushStream(
        @Header("userId")userId:Int,
        @Header("sessionId")sessionId:String,
        @Query("liveId") liveId:Int
    ):Observable<PutBean>
    //关闭直播
    @DELETE("live-platform/verify/closeLive")
    fun closeLive(
        @Header("userId")userId:Int,
        @Header("sessionId")sessionId:String
    ):Observable<CloseLiveBean>

    //修改昵称
    @PUT("live-user/verify/modifyNickName")
    fun getChangeName(
        @Header("userId")userId:Int,
        @Header("sessionId")sessionId:String,
        @Query("nickName")nickName:String
    ):Observable<ChangeNameBean>


    //查询我的信息
    @GET("live-user/verify/findPersonalInformation")
    fun getMyMessage(
        @Header("userId")userId:Int,
        @Header("sessionId")sessionId:String,
    ):Observable<MyMessageBean>


    //修改签名
    @PUT("live-user/verify/modifySignature")
    fun getChangeSignature(
        @Header("userId")userId:Int,
        @Header("sessionId")sessionId:String,
        @Query("count")count:String,
    ):Observable<ChangeNameBean>

    //音乐列表
    @GET("live-platform/findMusicList")
    fun getMusicBean(
        @Query("page")page:Int,
        @Query("size")size:Int,
    ):Observable<MusicBean>
}
